package com.ds.infra.rpc.example.weather.service.impl;

import com.ds.infra.rpc.annotation.RpcService;
import com.ds.infra.rpc.example.api.WeatherService;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.ThreadLocalRandom;

@RpcService(version = "1.0")
@Slf4j
public class WeatherServiceImpl implements WeatherService {

    @Override
    public String getWeather(String city) {
        int begin = 1 + ThreadLocalRandom.current().nextInt(25);
        int step = ThreadLocalRandom.current().nextInt(40);
        log.info("=====城市：{} 温度：{},{}", city, begin, begin + step);
        return String.format("【%s】今日晴转多云，%s℃～%s℃", city, begin, begin + step);
    }
}
